Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow viewClass override #4

Merged
merged 1 commit into from
Jun 24, 2015
Merged

Conversation

sarrala
Copy link
Contributor

@sarrala sarrala commented Jun 24, 2015

Allows viewClass override, doing it this way allows one to extend AjaxView to load application specific helpers for example:

Configure viewClass for this plugin, this code goes to your controller:

// Plugin would use Ajax.Ajax viewClass by default
// Setting it to plain Ajax allows using app specific AjaxView
$this->loadComponent('Ajax.Ajax',[
    'viewClass' => 'Ajax'
]);

Extend plugin view to implement your own stuff, namespace tells you where to put this file:

namespace App\View;
use Ajax\View\AjaxView as PluginAjaxView;
class AjaxView extends PluginAjaxView {
    // Load your custom stuff here
}

Allows viewClass override, doing it this way allows one to extend AjaxView to load application specific helpers for example:

Configure viewClass for this plugin, this code goes to your controller:
```php
// Plugin would use Ajax.Ajax viewClass by default
// Setting it to plain Ajax allows using app specific AjaxView
$this->loadComponent('Ajax.Ajax',[
	'viewClass' => 'Ajax'
]);
```

Extend plugin view to implement your own stuff, namespace tells you where to put this file:
```php
namespace App\View;
use Ajax\View\AjaxView as PluginAjaxView;
class AjaxView extends PluginAjaxView {
    // Load your custom stuff here
}
```
@dereuromark
Copy link
Owner

A test case would probably be nice, but then this is quite the trivial change :)
Nice one 👍

dereuromark pushed a commit that referenced this pull request Jun 24, 2015
Allow viewClass override
@dereuromark dereuromark merged commit baa216e into dereuromark:master Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants